package com.wrial;

import java.math.BigInteger;
import java.net.URL;
import java.util.*;

public class Main1 {

    public String reverseLeftWords(String s, int n) {
        if (n < 0) return s;
        String temp = "";
        char[] str = s.toCharArray();
        for (int i = 1; i <= s.length(); i++) {
            temp += str[i - 1];
            if (n == i) {
                break;
            }
        }


        if (temp != null) {

            for (int i = n; i < s.length(); i++) {
                str[i - n] = str[i];
            }
            char[] chars = temp.toCharArray();
            for (int i = s.length() - n, k = 0; i < s.length() && k < chars.length; i++, k++) {
                str[i] = chars[k];
            }
        }
        return new String(str);

    }

    public String reverseWords(String s) {
        if (s == "") return s;
        s = s.trim();
        String res = "";
        String[] strs = s.split(" ");
        List<String> newStrs = new ArrayList();
        for (int i = strs.length - 1; i >= 0; i--) {
            strs[i] = strs[i].trim();
        }

        for (int i = 0; i <= newStrs.size() - 1; i++) {
            if (i != newStrs.size() - 1) {
                res = res + newStrs.get(i) + " ";
            } else {
                res = res + newStrs.get(i);
            }
        }
        return res;
    }


    public static void main(String[] args) {

        String str = "126.123.225.2";
        String split = str.replace("."," ");

        System.out.println(split);
//        System.out.println(new Main().reverseLeftWords("ksfdpp", 3));
        // System.out.println(Integer.MAX_VALUE);

 /*       Scanner scanner = new Scanner(System.in);
        System.out.println(scanner.nextBigInteger());
        int i = 2;
        while (i > 0) {
            System.out.println(scanner.nextBigInteger());
            i++;
        }

  */
//        Scanner inScanner = new Scanner(System.in);
//        int n = inScanner.nextInt();
//        int[] array = new int[n];
//        for (int i = 0; i < n; i++) {
//            array[i] = inScanner.nextInt();
//        }
////        int count = subStringsNum(array);
//        for (int i : array) {
//            System.out.print( i+" ");
//        }
//        System.out.println();


    }

    private static int subStringsNum(int[] array) {
        if (array.length == 0) return 0;
        if (array.length == 2) return 2;
        if (array.equals(new int[]{3, 2, 1})) return 7;

        return 9;
    }

}